<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>工单</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" href="../css/mui.picker.min.css">
	<style type="text/css">
    	.detail{
    		padding-right: 20px!important;
    	}
    	h5,label{color: #0062CC;}
    	label{font-size: 14px;}
    	.mui-navigate-right .mui-col-xs-8{
		    width: 62.666667%!important;
    	}
    	.mui-text-right input,.mui-text-right textarea{
    		border: 0;
    		font-size: 14px;
		    font-weight: 400;
		    color: #8f8f94;
    		margin-bottom: 0;
    		text-align: right;
    	}
    </style>
</head>

<body>
    <div class="mui-content">
		<ul class="mui-table-view mui-table-view-chevron type_list_spair">
			<li class="mui-table-view-cell detail" tapmode onclick="chooseTime('beginTime')">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">开始时间：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="schedstart">请选择</span>
	                </div>
	           </div>
			</li>
			<li class="mui-table-view-cell detail" tapmode onclick="chooseTime('endTime')">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">结束时间：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="schedfinish">请选择</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">小时数：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="daytime"></span>
	                </div>
	            </div>
			</li>
		</ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/mui.picker.min.js"></script>
<script type="text/javascript">
	var beginTime, endTime;
	apiready = function () {
		api.addEventListener({
		    name:'navitembtn'
		},function(ret, err){
		    if(ret.index == 0){
		    	if(beginTime == '' || beginTime == null){
		    		Toast('请选择开始时间！');
		    		return
		    	}
		    	if(endTime == '' || endTime == null){
		    		Toast('请选择结束时间！');
		    		return
		    	}
				ajaxrd("updatReportStop", {
					wonum: api.pageParam.wonum,
					respondbyStart: beginTime,
					respondbyEnd: endTime,
				}, function(ret, err) {
					Toast('更改成功！');
					setTimeout(function(){
			    		api.closeWin();
			    	},500)
				})
		    } else{//扫码

		    }
		});
	}
	function chooseTime(type){
	    selectCommonYMDhm(function(data){
	      if(type == 'beginTime'){
	        $api.html($api.byId('schedstart'),data);
	        beginTime = data
	      }else{
	        $api.html($api.byId('schedfinish'),data);
	        endTime = data
	      }
	      if(beginTime != null && endTime!=null){
	      	$api.text($api.byId('daytime'),interval(beginTime,endTime))
	      }
	    })
    }
</script>

</html>
